import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/layout.vue'
import Test from '../views/test/test.vue'
import Test2 from '@/views/test/test2.vue'

export const routes = [
  {
    path: '/',
    name: 'home',
    meta: {
      title: '',
      hide: true
    },
    component: Layout,
  },
  {
    path: '/home',
    name: 'test',
    redirect:'/test/list',
    meta: {
      title: '测试页'
    },
    component: Layout,
    
    children: [
      {
        path: '/test/list',
        name: 'list',
        meta: {
          title: '测试列表'
        },
        component: Test,
      }
    ]
  },
  {
    path: '/test2',
    name: 'test2',
    meta: {
      title: '测试页2'
    },
    redirect:'/test/list',
    component: Layout,
    children: [
      {
        path: '/test2/list2',
        name: 'list2',
        meta: {
          title: '测试列表2'
        },
        component: Test2,
      }
    ]
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
